# -*- coding: utf-8 -*-
from db.mysql import MysqlClient
from common.helper import Helper
from itertools import product

name = "境内旅游保险"
mysql = MysqlClient()
plan = {
    "planA": {
        "days": ["1d"],
        "people_count": ["1"],
        "accident_death": ["50000"],
        "accident_medical": ["5000"],
        "airplane_death": ["0"],
        "train_death": ["0"],
        "ship_death": ["0"],
        "price": ["0.80"]
    },
    "planB": {
        "days": ["1d"],
        "people_count": ["1"],
        "accident_death": ["100000"],
        "accident_medical": ["10000"],
        "airplane_death": ["0"],
        "train_death": ["0"],
        "ship_death": ["0"],
        "price": ["1.60"]
    },
    "planC": {
        "days": ["1d"],
        "people_count": ["1"],
        "accident_death": ["150000"],
        "accident_medical": ["20000"],
        "airplane_death": ["100000"],
        "train_death": ["50000"],
        "ship_death": ["50000"],
        "price": ["5.50"]
    }

}
for k in plan:
    for v in product(plan[k]["days"],plan[k]["people_count"],plan[k]["accident_death"],plan[k]["accident_medical"],plan[k]["airplane_death"],plan[k]["train_death"],plan[k]["ship_death"],plan[k]["price"]):
        data = Helper.formatProductInfo( plan[k],v )
        data["name"] = name
        data["company"] = "中国人民保险"
        Helper.mergeTable( name,mysql,data )
